﻿<%@ Application Language="VB" %>
<%@ Import Namespace="Cls_Common" %>
<%@ Import Namespace="SecurityService" %>
<script runat="server">
    Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application startup
        Application("OnlineUsers") = 1
        RegisterRouters(System.Web.Routing.RouteTable.Routes)
    End Sub
    
    Sub RegisterRouters(ByVal routers As System.Web.Routing.RouteCollection)
        'Header Menu
        routers.MapPageRoute("thongtinKS", "thong-tin-khach-san.html", "~/Page/Hotel/ThongTinChung.aspx")
        routers.MapPageRoute("danhsachKhachTT", "danh-sach-khach-tam-tru.html", "~/Page/Customer/List.aspx")
        routers.MapPageRoute("NhapTrucTuyen", "nhap-truc-tuyen.html", "~/Page/Customer/Create.aspx")
        routers.MapPageRoute("InDanhSachList", "danh-sach-in.html", "~/Page/Customer/PrintList.aspx")
        routers.MapPageRoute("InDanhSach", "in-danh-sach.html", "~/Page/Customer/PrintPreView.aspx")
        
        routers.MapPageRoute("ChinhSuaThongTinKhach", "chinh-sua-thong-tin-khach-{Id}.html", "~/Page/Customer/Edit.aspx")
        routers.MapPageRoute("ChiTiet", "chi-tiet-thong-tin-khach-{Id}.html", "~/Page/Customer/Detail.aspx")
        routers.MapPageRoute("UploadFile", "upload-file.html", "~/Page/Customer/Upload.aspx")
        routers.MapPageRoute("ImportFile", "import-file.html", "~/Page/Customer/ImportFromExcel.aspx")
        routers.MapPageRoute("huongdan", "huong-dan.html", "~/Page/HuongDan.aspx")
        routers.MapPageRoute("thonbao", "thong-bao.html", "~/Page/ThongBao/List.aspx")
        
    End Sub
    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application shutdown
    End Sub
        
    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when an unhandled error occurs
    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when a new session is started
        Session("UserName") = Nothing
        Session("RoleID") = Nothing
        Session("MenuId") = Nothing
        Session("LanguageId") = 1
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when a session ends. 
        ' Note: The Session_End event is raised only when the sessionstate mode
        ' is set to InProc in the Web.config file. If session mode is set to StateServer 
        ' or SQLServer, the event is not raised.
        Session("UserName") = Nothing
        Session("MenuId") = Nothing
    End Sub
       
</script>